Repository navigation
feat(supabase): send auth email through Resend with branded templates - #45
Merged
Merged
Conversation
The built-in Supabase sender only reaches our own team and refuses custom templates, so people signing up with a password never got their confirmation link. Production now sends through smtp.resend.com as Potluck <[email protected]>, with the key from the production environment, and at most 30 auth emails an hour. Sign up, sign in link, password reset, email change and the reauthentication code get Supper Club styled templates in supabase/templates, shared with the local stack, and every link stays the ConfirmationURL the e2e mail helper reads. The security notices get their Potluck subjects back in production, with bodies, and Google linking or unlinking now sends one too. The deploy stops before db push when SUPABASE_AUTH_SMTP_PASSWORD is empty: the CLI skips an unset env() secret, so a first push would otherwise turn on SMTP with no password. Co-authored-by: Ferrin <[email protected]> Co-authored-by: noorelmosrati <[email protected]>
Deployment lists the SUPABASE_AUTH_SMTP_PASSWORD secret, the guard that stops a deploy without it, and what config push now sets for email. The launch checklist marks auth email as done and keeps what is left for notification email, which can reuse the Resend account but shares its 100 a day. Security notes Resend as the auth email processor and how to rotate the key. Co-authored-by: Ferrin <[email protected]> Co-authored-by: noorelmosrati <[email protected]>
musa-kal
force-pushed
the
feat/custom-smtp
branch
from
November 17, 2026 00:01
308f8f1 to
bc70d23
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Send Potluck's auth email through Resend with branded templates, because the built-in Supabase sender only delivers to the Supabase team.
No secret may be committed.
What Changed
supabase/config.tomlsends production auth email through Resend SMTP (smtp.resend.com:465, password fromenv(SUPABASE_AUTH_SMTP_PASSWORD), senderPotluck <[email protected]>) and capsemail_sentat 30 per hour. It replaces the production blocks that forced Supabase's default notification subjects. Email confirmation stays on.supabase/templates/, used by both the local stack and production: confirmation, magic link, recovery, email change and reauthentication, plus security notices for password, email, MFA enroll/unenroll and the new identity-linked notice. Each has its own Potluck subject, inline colours and a plain-text fallback link. Action links stay{{ .ConfirmationURL }}so the e2e mail helper still finds them. The templates folder is excluded from prettier.deploy.ymlpassesSUPABASE_AUTH_SMTP_PASSWORDtosupabase config push. If the secret is empty, the migrate job fails before it links or pushes anything to production.docs/deployment.md,launch-checklist.md,security.md,architecture.mdandsupabase/AGENTS.mddescribe the Resend setup and the templates.Risk Assessment
✅ Low: The change is config, templates and docs that meet every intent criterion. The SMTP guard runs before
supabase link, no secret is committed, the templates keep the/auth/v1/verifylinks the e2e helper reads plus text fallbacks, and both prior-round fixes are in place; the one leftover is a minor doc wording issue.Testing
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
supabase/config.toml:290- New component: two extra security notices were turned on,[auth.email.notification.identity_linked](290) andidentity_unlinked(295), each with its own template. The intent asks for custom subjects and templates on the security notices and for removing the production blocks that forced default subjects. It does not ask to enable new notice types.identity_unlinkedcannot fire from the app: apps/web/src never callsunlinkIdentity, orlinkIdentityeither. Both notices still use the project-wide 30/hour email budget and Resend's 100/day quota. Suggested fix: remove both blocks and supabase/templates/identity_linked_notification.html and identity_unlinked_notification.html, and drop the 'sign in method' wording in docs/architecture.md:933, docs/deployment.md (shared templates paragraph) and docs/launch-checklist.md. Or confirm they are intended.supabase/templates/password_changed_notification.html:29- The intent says templates must 'include a text fallback link'. The four action-link templates do (confirmation, magic_link, recovery, email_change). The security notices that show a 'Reset my password' button ({{ .SiteURL }}/forgot-password) give no plain-text copy of that URL. The same gap is at identity_linked_notification.html:29, identity_unlinked_notification.html:29, mfa_factor_enrolled_notification.html:29 and mfa_factor_unenrolled_notification.html:29. Please confirm whether the fallback requirement covers these buttons too. If it does, add the same 'Button not working? Paste this link' line to each.🔧 Fix applied.
1 warning still open:
docs/architecture.md:1041- The Hosting section still says 'auth email uses Supabase built-in SMTP for now (rate-limited); swap to Resend with a sender onfermulate.com.' This change switches production auth email to Resend, so the line is now wrong. It also contradicts the updated security-notice line at docs/architecture.md:933, along with docs/deployment.md, docs/launch-checklist.md section 3 and docs/security.md, all of which say auth email goes through Resend. The intent requires architecture.md to describe the new setup. Suggested fix: rewrite the line to say auth email goes through Resend SMTP fromPotluck <[email protected]>([remotes.production.auth.email.smtp], templates insupabase/templates/) and that notification email is built but off untilapp_config.email_notificationsis turned on (launch checklist link). A grep of the changed docs, supabase/ and .github/ found no other stale 'built-in sender' text.🔧 Fix applied.
1 info still open:
docs/launch-checklist.md:39- The line 'Production allows 30 auth emails an hour, inside Resend's free plan (100 a day, 3,000 a month)' reads as if the cap keeps auth email inside the free plan. It does not: 30 an hour can reach 720 a day, and Resend rejects anything past 100 a day, so sign ups would then fail to send. The config.toml comment (line 521) and docs/deployment.md:71 state it accurately ('one busy hour stays under a third of the daily allowance'). Suggested fix: reword to say the hourly cap keeps a single busy hour under a third of Resend's 100 a day, and that the daily quota is not enforced by Supabase.⏭️ **Test** - skipped
Step was skipped.
✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.